Communication apparatus and method of controlling the same

ABSTRACT

This invention relates to a communication apparatus capable of facilitating a connection with a device in a network by using a discovery protocol for discovering a device in a network. After selecting a device based on pieces of device information transmitted from devices in the network in response to a search command to search devices in the network, the communication apparatus transmits a notification signal to notify devices in the network of the presence of the communication apparatus. If a connection request received from a device which has received the notification signal is one transmitted from the selected device, the communication apparatus transmits a response representing that connection is accepted for the connection request.

TECHNICAL FIELD

The present invention relates to a communication apparatus and, moreparticularly, to a communication apparatus which establishes aconnection with a device in a network.

The present invention also relates to a method of controlling thecommunication apparatus.

BACKGROUND ART

Recently, digital cameras incorporating a wireless communicationfunction and recording media equipped with a wireless communicationfunction have made their debut. By using these devices, an image fileobtained by a digital camera can be quickly transmitted to a personalcomputer (to be referred to as a PC hereinafter).

However, to connect to a specific PC on a network when wirelesslyconnecting to a PC, information for specifying the destination PC needsto be registered in a digital camera. To solve this problem, thefollowing digital camera has been proposed (Japanese Patent Laid-OpenNo. 2006-67231). More specifically, when wirelessly connecting a digitalcamera and PC, the digital camera is connected to the target PC via aUSB cable, and pairing information for specifying the communicationpartner PC is set in advance in the digital camera. When the start ofwireless connection is instructed, the digital camera executesadvertisement to the network and establishes a wireless connection withthe specific PC based on the set pairing information.

Before establishing a wireless connection, the digital camera disclosedin Japanese Patent Laid-Open No. 2006-67231 needs to be connected to acommunication partner PC via a USB cable and set in advance pairinginformation for specifying it, resulting in poor usability.

Depending on the installed OS, the PC has a different discovery protocolused in connection processing between devices. Typical discoveryprotocols are UPnP (Universal Plug and Play) and Bonjour.

UPnP is a technical specification for connecting devices such as a PC,peripheral device, AV system, telephone, and household appliance in thehome via a network, and providing their functions to each other. UPnPwas proposed by Microsoft in 1999 and is supported by 20 or morecompanies including Intel. UPnP is founded on a standard technology forthe Internet, and aims at operating a device by only connecting it to anetwork without any complicated operation or setting work.

Bonjour is a technique of automatically detecting and connecting adevice on an IP network such as Ethernet or wireless LAN (Local AreaNetwork). Bonjour has been developed as a zero configuration technologywhich is based on a standard protocol defined by the IETF (InternetEngineering Task Force) Zeroconf working group and has the sameusability as that of Apple Talk. The Zeroconf working group requeststhree functions: IP addressing, naming, and service discovery. Thesefunctions are implemented as follows. In addressing, communication notinvolving a router is determined to be of a local network, and an IPaddress is automatically acquired. Naming uses a multicast DNS in whichno local host name need always be set. In service discovery, a devicehaving a function the user wants to use is searched for. Bonjour ismainly adopted in Mac OS available from Apple.

Another discovery protocol is Jini available from Sun Microsystems. Inthe digital camera disclosed in Japanese Patent Laid-Open No.2006-67231, pairing information needs to be set in advance while beingaware of the type of discovery protocol for each PC. Therefore, it isnot easy for a user having little knowledge about the network tocorrectly set pairing information.

A digital camera and PC have a so-called device & control pointrelationship in which the digital camera provides an image file to thePC in accordance with an instruction from the PC to acquire the imagefile. Generally, the PC serving as the control point controls a seriesof operations including the start of a connection with the digitalcamera, image transfer, and the end of the connection. However, the usermay want to transfer an image file to the PC immediately after shooting,or change the transmission destination PC depending on the type of imagefile. In such a case, usability would be improved if the user were ableto list PCs on the network by operating the digital camera and instructa connection with the PC he wants while holding the digital camera withhis hand.

SUMMARY OF INVENTION

The present invention provides a communication apparatus capable offacilitating a connection with a device in a network by using adiscovery protocol for discovering a device in a network as well as acontrol method thereof.

According to an aspect of the present invention, there is provided acommunication apparatus which establishes a connection with a device ina network by using a discovery protocol for discovering the device,comprising: first transmission means for transmitting a search commandto search devices in the network; first reception means for receivingpieces of device information transmitted from devices in the network inresponse to the search command; first selection means for selecting adevice based on the pieces of device information received by the firstreception means; second transmission means for transmitting anotification signal to notify devices in the network of presence of thecommunication apparatus after the selection by the first selectionmeans; second reception means for receiving a connection requesttransmitted from a device in the network, the connection request beingtransmitted by a device which has received the notification signal;determination means for determining whether the connection request hasbeen transmitted from the device selected by the first selection means;and third transmission means for transmitting a response representingthat a connection is accepted in response to the connection request ifthe determination means determines that the connection request has beentransmitted from the device selected by the first selection means.

According to another aspect of the present invention, there is provideda method of controlling a communication apparatus which establishes aconnection with a device in a network by using a discovery protocol fordiscovering the device, the method comprising: a first transmission stepof transmitting a search command to search devices in the network; afirst reception step of receiving pieces of device informationtransmitted from devices in the network in response to the searchcommand; a first selection step of selecting a device based on thepieces of device information received in the first reception step; asecond transmission step of transmitting a notification signal to notifydevices in the network of presence of the communication apparatus afterthe selection in the first selection step; a second reception step ofreceiving a connection request transmitted from a device in the network,the connection request being transmitted by a device which has receivedthe notification signal; a determination step of determining whether theconnection request has been transmitted from the device selected in thefirst selection step; and a third transmission step of transmitting aresponse representing that a connection is accepted in response to theconnection request if it is determined in the determination step thatthe connection request has been transmitted from the device selected inthe first selection step.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing the arrangement of a digital camera;

FIG. 2 is a block diagram showing the arrangement of a PC;

FIG. 3 is a conceptual view showing the connection configuration of thedigital camera and PC;

FIG. 4 is a flowchart showing image transfer processing by the digitalcamera;

FIGS. 5A to 5E are views each showing a GUI displayed in image transferprocessing by the digital camera;

FIG. 6 is a flowchart showing image transfer processing by the PC;

FIGS. 7A and 7B are flowcharts showing discovery processing by thedigital camera;

FIG. 8 is a flowchart showing device search processing by the digitalcamera;

FIG. 9 is a flowchart showing advertisement processing by the digitalcamera;

FIGS. 10A to 10C are views showing SSDP messages to betransmitted/received between the digital camera and the PC;

FIGS. 11A and 11B are views showing descriptions to betransmitted/received between the digital camera and the PC;

FIGS. 12A and 12B are views showing TXT records to betransmitted/received between the digital camera and the PC;

FIGS. 13A to 13F are views each showing a GUI displayed in discoveryprocessing by the digital camera;

FIG. 14 is a view showing pairing information of the digital camera;

FIG. 15 is a flowchart showing discovery processing by the digitalcamera; and

FIG. 16 is a flowchart showing discovery processing by the PC.

DESCRIPTION OF EMBODIMENTS First Embodiment

Exemplary embodiments of the present invention will now be described indetail in accordance with the accompanying drawings. However, thepresent invention is not limited to the following embodiments. Also,various embodiments may be appropriately combined.

[Arrangement of Digital Camera]

A digital camera capable of capturing still images and moving imageswill be explained as an example of a communication apparatus accordingto the present invention. Note that a device including a digital camerasuch as a so-called camera-equipped mobile phone or camera-equippedtablet device is also an example of the communication apparatus.

FIG. 1 is a block diagram showing the arrangement of a digital camera100 according to the embodiment.

A control unit 101 is formed from, for example, a CPU (MPU) and memory(DRAM and SRAM). The control unit 101 controls the respective blocks ofthe digital camera 100 by executing various processes (programs), andcontrols data transmission between the respective blocks. The controlunit 101 controls the respective blocks of the digital camera 100 inaccordance with an operation signal from an operation unit 102 whichaccepts an operation from the user.

The operation unit 102 is formed from switches for inputting variousoperations regarding shooting, such as a power button, zoom adjustmentbutton, and autofocus button. The operation unit 102 can also be formedfrom a menu display button, SET button, cursor key, pointing device, andtouch panel. When the user operates these keys and buttons, theoperation unit 102 transmits an operation signal to the control unit101. The operation unit 102 further includes a release button. Therelease button is formed from SW1 which is pressed in a so-called halfstroke state, and SW2 which is pressed in a so-called full stroke state.A shooting preparation instruction is output by pressing SW1, and ashooting instruction is output by pressing SW2. Note that a releasebutton for still imaging shooting and a release button for moving imageshooting are formed from a single button in the embodiment, but can beformed from separate buttons.

A bus 103 is a general-purpose bus for sending various data, controlsignals, instruction signals, and the like to the respective blocks ofthe digital camera 100.

An image sensing unit 110 controls the quantity of light by a stop, andconverts the optical image of an object captured via a lens into animage signal by an image sensor such as a CCD sensor or CMOS sensor.

An audio input unit 120 collects a sound around the digital camera 100by an internal omnidirectional microphone, an external microphoneconnected via an audio input terminal, or the like.

A memory 104 includes, for example, a RAM (Random Access Memory) andflash memory, and includes both a nonvolatile memory and a volatilememory for temporarily recording image signals, audio signals, settinginformation of the digital camera 100, and the like.

A recording medium 141 is a recording medium connectable to the digitalcamera 100. The recording medium 141 can record various data and thelike generated by the digital camera 100. Examples of the recordingmedium 141 are a hard disk, optical disk, and flash memory. Theembodiment will exemplify a flash memory device which is called a memorycard and can be mounted in the digital camera 100.

An audio output unit 151 is formed from, for example, an audio outputterminal, and transmits an audio signal to output a sound from aconnected earphone, loudspeaker, or the like. The audio output unit 151may be incorporated in the digital camera 100.

A video output unit 150 is formed from, for example, a video outputterminal, and transmits an image signal to display a video on aconnected external display or the like. The audio output unit 151 andvideo output unit 150 may be formed from one integrated terminal such asan HDMI® terminal.

The digital camera 100 according to the embodiment can communicate withanother device via a communication unit 152 and network. Thecommunication unit 152 transmits/receives data to/from an externaldevice by serial or parallel communication via a wire or wirelesslyusing a communication interface such as RS232C, USB, IEEE1394, P1284,SCSI, modem, LAN, or IEEE802.11 interface. By executing a communicationprotocol conforming to the communication interface, the communicationunit 152 can transmit/receive data to/from an external device. Examplesof the communication protocol are HTTP (Hyper Text Transfer Protocol)and PTP-IP (Picture Transfer Protocol over IP).

A display unit 130 displays image data recorded on the recording medium141 and GUIs such as various menus. The display unit 130 can be, forexample, a liquid crystal display or organic EL display.

[Arrangement of Personal Computer (PC)]

A personal computer (PC) capable of loading still images and movingimages will be explained as an example of an information processingapparatus. Note that a printer, so-called tablet PC, smartphone, and TVreceiver with Internet connection capability are also examples of aninformation processing apparatus.

FIG. 2 is a block diagram showing the arrangement of the PC 200according to the embodiment.

A PC 200 includes a display unit 201, operation unit 202, CPU 203,primary storage device 204, secondary storage device 205, andcommunication device 206. The basic functions of the respective unitsare the same as those in the digital camera 100, and a detaileddescription thereof will not be repeated. Note that a display devicesuch as an LCD is used as the display unit 201. The PC 200 need notinclude the display unit 201, and suffices to have a display controlfunction of controlling display on the display unit 201. The secondarystorage device 205 may be a device which reads out and writes data fromand in a hard disk drive or external storage medium. Examples of theexternal storage medium are an optical disk (for example, DVD-RW,CD-ROM, CD-R, or DVD-RAM), a magnetic disk (for example, flexible diskor MO), and a nonvolatile memory (for example, flash memory). As theoperation unit 202, a keyboard, mouse, or touch panel is usable.

A communication interface and protocol used in the communication device206 are the same as those in the digital camera 100, and a descriptionthereof will not be repeated. The PC 200 can transmit/receive datato/from an external device using the communication device 206.

[Connection Configuration of Digital Camera and PC]

A connection configuration in the infrastructure will be explained as anexample of the network participation form of the digital camera and PC.When one-to-one connection of the digital camera and PC suffices, theycan be connected by ad-hoc or Wi-Fi Direct as an example. Wi-Fi Directis a specification formulated by the Wi-Fi Alliance which is anassociation devoted to promoting wireless LANs. According to thisspecification, devices such as a wireless LAN-equipped mobile phone,tablet, PC, digital camera, printer, and portable game player can beconnected wirelessly even without an access point.

FIG. 3 is a conceptual view showing the configuration of a network inwhich the digital camera 100 and a plurality of PCs 200 participate.

Reference numeral 301 denotes a router. The router provides a routingfunction of building a network and relaying communication betweennetwork-connected devices such as a portable device and PC. The routercomplies with the Internet protocol suit, and builds a LAN using an IPaddress assigned to it as a gateway. The router 301 includes aninterface for wired or wireless connection. As an example of the wiredconnection, a router and device are physically connected by a LAN cable.An example of the wireless connection is a connection complying withIEEE802.11x (x is a, b, g, n, or the like). An SSID (Service SetIDentifier) and encryption key are set in the router. When a device tobe connected sets the SSID and encryption key and is approved, itestablishes a connection with the router.

When a device such as a portable device or PC is connected to the LANvia a wire or wirelessly, an IP address is assigned to the connecteddevice automatically or manually. A typical protocol in automaticassignment is DHCP (Dynamic Host Configuration Protocol). Data protocolsand IP addresses flowing through a network in communication betweendevices are analyzed to determine a path through which data is to betransferred.

In the embodiment, the router 301 builds a LAN in which the gateway isindicated by 192.168.0.1. An IP address of 192.168.0.10 is assigned tothe digital camera 100 wirelessly connected to the LAN. An IP address of192.168.0.20 is assigned to a wirelessly connected PC 200 a “ComputerA”.An IP address of 192.168.0.21 is assigned to a wirelessly connected PC200 b “ComputerB”. An IP address of 192.168.0.22 is assigned to awire-connected PC 200 c “ComputerC”. On the premise of the networkhaving this infrastructure, the embodiment will explain a method ofconnecting the digital camera 100 to the PC 200 the user wants toconnect.

In the digital camera 100 according to the embodiment, a secondarystorage device 105 records a program capable of communicating with thePC 200 in conformity with the UPnP and Bonjour specifications serving asdiscovery protocols for device search on a network. The program recordscommands for executing communication using UPnP and Bonjour, and deviceinformation specific to the digital camera 100 that is necessary forcommunication by UPnP and Bonjour.

In each of the PCs 200 a and 200 c according to the embodiment, aprogram capable of communicating with the digital camera 100 inconformity with the UPnP specification serving as one discovery protocolis installed in the secondary storage device 205. The program recordscommands for executing communication using UPnP, and PC-specific deviceinformation necessary for UPnP communication.

In the PC 200 b according to the embodiment, a program capable ofcommunicating with the digital camera 100 in conformity with the Bonjourspecification serving as one discovery protocol is installed in thesecondary storage device 205. The program records commands for executingcommunication using Bonjour, and PC-specific device informationnecessary for Bonjour communication.

In the digital camera 100 according to the embodiment, a program capableof transmitting/receiving an image file to/from the PC 200 in conformitywith the PTP-IP specification serving as a protocol for transferring animage is recorded in the secondary storage device 105. The programrecords a command for executing communication using PTP-IP, an objectformat code which defines a file transferable by PTP-IP communication,and a device property serving as information for identifying thesettings or state conditions of the digital camera.

In each of the PCs 200 a, 200 b, and 200 c according to the embodiment,a program capable of communicating with the PC 200 in conformity withthe PTP-IP specification serving as a protocol for transferring an imagefile is installed in the secondary storage device 205.

Image files are saved in advance in the recording medium 141 in thedigital camera 100 and the secondary storage device 205 in the PC 200according to the embodiment. Image transmission processing in theembodiment is implemented by connecting the digital camera 100 and PC200 via a network, and saving an image file supplied from the digitalcamera 100 in an arbitrary directory in the secondary storage device 205of the PC 200.

The embodiment will exemplify in detail a form in which the digitalcamera 100 is connected to the PC 200 using the UPnP and Bonjourdiscovery protocols, and transmits an image file to the PC 200 usingPTP-IP. Note that the present invention is not limited by the networkconfiguration, network connection method, discovery protocol type, ortransfer protocol described in the embodiment.

[Image Transfer Processing in Digital Camera]

First, the operation of the digital camera 100 in the following seriesof processes will be explained.

(1) The digital camera 100 and PC 200 are connected via a network builtby the router 301.

(2) An image file supplied from the digital camera 100 is saved in anarbitrary directory in the secondary storage device 205 of the PC 200.

(3) The digital camera 100 leaves the network.

FIG. 4 is a flowchart showing the basic operation of the digital camera100. This sequence starts when the control unit 101 detects that theuser has pressed a power button or playback button included in theoperation unit 102. Note that processing represented by the flowchart isimplemented by controlling the respective units of the digital camera100 by the control unit 101 in accordance with input signals from therespective units and a program. This also applies to processingrepresented by another flowchart, unless otherwise specified.

First, in step S401, the control unit 101 executes initializationprocessing for the digital camera 100. In the initialization processing,the control unit 101 checks whether the recording medium 141 has beenmounted, drives a lens barrel for shooting preparation, and switches amode to be activated by determining which of the power button andplayback button has been pressed. The mode includes a shooting mode inwhich an image file is obtained by shooting, a playback mode in which animage file is displayed and browsed on the display unit 130, a menu modein which shooting parameters are changed, and a wireless connection modein which wireless connection is executed. In the embodiment, when theuser presses the play button included in the operation unit 102 toactivate the camera, the camera starts in the playback mode and displaysthe GUI (FIG. 5A) of the playback mode in the embodiment on the displayunit 130.

In step S402, the control unit 101 detects whether the wirelessconnection mode has been selected. A button icon 501 for shifting to thewireless connection mode is arranged on the GUI of FIG. 5A. If the useroperates the operation unit 102 and presses the button icon 501, thecontrol unit 101 detects that the wireless connection mode has beenselected, activates the wireless connection mode, displays the GUI ofFIG. 5B on the display unit 130, and advances to step S403. If NO instep S402, the control unit 101 waits until the button icon 501 ispressed.

In step S403, the control unit 101 detects whether a device to beconnected has been selected. On the GUI of FIG. 5B, a list of devicesconnectable to the digital camera 100 is displayed as button icons. Whenthe user presses a button icon, the control unit 101 advances toprocessing of connecting the digital camera 100 to each device. A buttonicon 502 is a button icon for advancing to connection processing withthe PC 200 serving as a connectable device. The embodiment aims atconnecting the digital camera 100 to the PC 200. Hence, if the useroperates the operation unit 102 and presses the button icon 502, thecontrol unit 101 detects that a device to be connected has beenselected, displays the GUI of FIG. 5C on the display unit 130, andadvances to step S404. If NO in step S403, the control unit 101 waitsuntil the user presses the button icon of a device to be connected.

In step S404, the control unit 101 detects whether the currentconnection is a new connection. The GUI of FIG. 5C displays a buttonicon 503 for connecting a PC 200 which has not been connected before,and a button icon 504 for connecting again a PC 200 which has beenconnected before. If the user operates the operation unit 102 andpresses the button icon 503, the control unit 101 detects that thedigital camera 100 is to be connected to a PC 200 which has not beenconnected before, displays the GUI of FIG. 5D on the display unit 130,and advances to step S405. If the user presses the button icon 504, thecontrol unit 101 detects that the digital camera 100 is to be connectedto a PC 200 which has been connected before, and advances to step S406.

In step S405, the control unit 101 accepts input of a setting item fornetwork connection. On the GUI of FIG. 5D, text boxes for entering anSSID (Service Set IDentifier) and encryption key, which are settingitems necessary for wireless connection to the router 301, are arranged.Note that the SSID is the identifier of an access point in an IEEE802.11wireless LAN, and is a name assigned to avoid interference. Theencryption key is a key for performing wireless LAN encryption toprevent unauthorized access. The user displays a software keyboard (notshown) on the display unit 130, and operates the operation unit 102 toenter characters. The control unit 101 temporarily records all theselected characters in the memory 104.

In step S406, the control unit 101 performs network connection. A buttonicon 505 on the GUI of FIG. 5D is a button icon for supporting the startof wireless connection. When connecting the digital camera 100 to a PC200 which has not been connected before, the user operates the operationunit 102 and presses the button icon 505. Then, the control unit 101starts a connection with the router 301 based on the SSID and encryptionkey temporarily recorded in the memory 104 in step S405. An SSID andencryption key used to connect the digital camera 100 again to a PC 200which has been connected before are saved as pairing information in thenonvolatile memory of the memory 104 together with another piece ofinformation when the connection with the PC 200 succeeded. Details ofthe pairing information will be described later. When connecting thedigital camera 100 to a PC 200 which has been connected before, thecontrol unit 101 loads, into the RAM of the memory 104, the SSID andencryption key of the pairing information recorded in the nonvolatilememory of the memory 104, and starts a connection with the router 301.If the connection with the router 301 is established, the router 301assigns an IP address to the digital camera 100. The control unit 101records the assigned IP address in the RAM of the memory 104.

In step S407, the control unit 101 performs discovery (device search)for a connection with the PC 200. Details of the discovery will bedescribed later.

In step S408, the control unit 101 starts the image transfer service.Image transfer service in the embodiment means image file transferprocessing using PTP-IP. If a PC 200 to be connected has been selectedin step S407, the PC 200 transmits, to the digital camera 100, a commandpacket for establishing a session. When the digital camera 100 receivesthe command packet via the communication unit 152, the control unit 101analyzes the packet and executes processing for establishing a session.For PTP-IP in the embodiment, this command is an OpenSession command.After establishing a session, the digital camera 100 transmits aresponse command to the PC 200, displays the GUI of FIG. 5E on thedisplay unit 130, and starts the image transfer service. The GUI of FIG.5E is a GUI exemplifying a case in which the connection with the PC 200a in FIG. 3 has been completed. As another example, no GUI may bedisplayed on the display unit 130.

In step S409, the control unit 101 detects whether it has received animage transmission request from the PC 200. The digital camera 100receives, from the PC 200 via the router 301, a command packetrepresenting an image file transfer instruction. The control unit 101analyzes the command packet, and if it detects that this commandrepresents an image file transmission instruction, advances to stepS410. If NO in step S409, the control unit 101 waits until it receivesthe command packet instructing transmission of an image file.

In step S410, the control unit 101 transmits an image file to the PC200. In the transmission processing, the control unit 101 reads, fromthe recording medium 141, an image file designated by the commandpacket, and loads it into the RAM of the memory 104. Then, the controlunit 101 divides the image file into packets, and transmits them to thePC 200. After transmitting all packets corresponding to the size of theimage file, the control unit 101 transmits a response command to the PC200, completing the image transmission.

In step S411, the control unit 101 detects whether it has received animage transfer service end notification from the PC 200. The PC 200transmits, via the router 301, a command packet for ending the sessionwith the digital camera 100 from the PC 200. For PTP-IP in theembodiment, this command is a CloseSession command. The control unit 101analyzes the command packet received via the communication unit 152,executes the end of the session, and advances to step S412. If NO instep S411, the control unit 101 waits until it receives the commandpacket for ending the session.

In step S412, the control unit 101 leaves the network. In this case, thecontrol unit 101 unloads the program which has been loaded into the RAMof the memory 104 and runs according to the image transfer protocol.Then, the control unit 101 multicasts a network leave command based onthe discovery protocol to the network. For UPnP in the embodiment,SSDP:Byebye is multicast. For Bonjour, MulticastDNS:goodbye ismulticast.

The basic operation regarding image transfer in the digital camera 100according to the embodiment has been described. The digital camera 100functions as a device which operates in accordance with an instructiontransmitted in response to an instruction of the image transfer protocolfrom the PC 200.

[Image Transfer Processing in PC]

Next, the operation of the PC 200 in the above-described processes (1)to (3) will be explained.

FIG. 6 is a flowchart showing the basic operation of the PC 200. Thissequence starts upon completion of activation processing of the PC 200.In the activation processing, the PC 200 is activated by pressing apower button (not shown) serving as one button of the operation unit.The PC 200 performs checking of each hardware module and the like. TheCPU 203 loads, into the primary storage device 204, an operating system(to be referred to as an OS hereinafter) which is saved in the secondarystorage device 205.

First, in step S601, the CPU 203 performs network connection. In thenetwork connection, the CPU 203 connects the PC 200 via the wireless orwired communication device 206 to the router 301 which builds a desirednetwork. The CPU 203 records an IP address assigned by the router 301 inthe primary storage device 204. Note that the wireless and wiredconnection methods are the same as those in FIG. 3 and step S406 of FIG.4, and a description thereof will not be repeated.

In step S602, the CPU 203 performs discovery (device search). Details ofthe discovery will be described later.

In step S603, the CPU 203 instructs the start of the image transferservice. The image transfer service in the embodiment means image filetransfer processing using PTP-IP. In this case, the CPU 203 transmits acommand packet for establishing a session with the digital camera 100.For PTP-IP in the embodiment, this command is an OpenSession command. Ifthe CPU 203 receives a response packet transmitted after the digitalcamera 100 processes the command packet, and determines that the imagetransfer service has started, it advances to step S604.

In step S604, the CPU 203 instructs the digital camera 100 to transmitan image file. The CPU 203 generates a command packet instructingtransfer of an image file by PTP-IP, and transmits it to the digitalcamera 100. For PTP-IP in the embodiment, this command is a GetObjectcommand. Before GetObject, it is necessary to execute a GetDeviceInfocommand and GetObjectInfo command, and acquire device information of thedigital camera 100 and the number and type of image files saved in therecording medium 141.

In step S605, the CPU 203 receives an image file. The CPU 203 saves thedata packet of the image file transmitted from the digital camera 100 inan arbitrary directory of the secondary storage device 205. Uponreceiving all packets corresponding to the size of the image file, theCPU 203 finalizes the image file and completes the saving. When aplurality of image files are received, the CPU 203 repeats theabove-described processing.

In step S606, the CPU 203 determines whether it has detected an imagetransfer service end instruction. If the user ends the transfer of theimage file he wants, and presses an end button arranged on the GUI of animage transfer program (not shown) displayed on the display unit 201 inorder to end the image transfer service, the CPU 203 detects the imagetransfer service end instruction and advances to step S607. If NO instep S606, the CPU 203 returns to step S604, and instructs again thedigital camera 100 to transmit an image file.

In step S607, the CPU 203 instructs the end of the image transferservice. In this case, the CPU 203 transmits, to the digital camera 100,a command packet for ending the session with the digital camera 100. ForPTP-IP in the embodiment, this command is a CloseSession command.

If the CPU 203 receives a response command transmitted after the digitalcamera 100 processes the command packet, it ends the image transferservice program in the PC 200.

The basic operation regarding image transfer in the PC 200 according tothe embodiment has been described. The PC 200 functions as a controlpoint which instructs the digital camera 100 to transmit an imageaccording to the image transfer protocol.

[Discovery Processing (Connection for First Time) in Digital Camera]

Details of the discovery in step S407 of FIG. 4 will be explained. FIGS.7A and 7B are flowcharts showing a discovery operation in the digitalcamera 100.

First, in step S701, the control unit 101 detects whether the digitalcamera 100 is to be connected to a PC 200 which has not been connectedbefore. If the user selects the button icon 503 on the GUI of FIG. 5Cdisplayed in step S404 of FIG. 4, the control unit 101 determines thatthe digital camera 100 is to be connected to a PC 200 which has not beenconnected before, and advances to step S702. If NO in step S701, thecontrol unit 101 advances to processing A in order to connect thedigital camera 100 to a PC 200 which has been connected before.

In step S702, the control unit 101 starts searching for anetwork-connected PC 200. Details of the search processing for the PC200 will be explained with reference to a flowchart shown in FIG. 8. Asdescribed with reference to FIG. 3, the digital camera 100 in theembodiment copes with communication by both the UPnP and Bonjourdiscovery protocols. For this reason, UPnP-compliant PCs andBonjour-compliant PCs detected by these two discovery protocols serve asconnection targets. In FIG. 3 of the embodiment, the PCs 200 a and 200 care UPnP-compliant PCs, and the PC 200 b is a Bonjour-compliant PC. Anexample of the UPnP-compliant PC is a PC in which a Windows® OSavailable from Microsoft is installed. An example of theBonjour-compliant PC is a PC in which Mac OS® available from Apple isinstalled. The control unit 101 starts device search and displays theGUI of FIG. 13A on the display unit 130.

In step S801, the control unit 101 detects whether it has received anSSDP:Alive message multicast. SSDP (Simple Service Discovery Protocol)is a protocol for searching for and discovering a device supporting UPnPon a network. SSDP:Alive performs a so-called Advertisement operation ofmulticasting the presence of a device to devices on a network when thedevice is connected to the network. Advertisement in FIG. 10A is anexample of SSDP data multicast by the PC 200 for Advertisement. A HOSTheader indicates a multicast IP address. A CHACHE-CONTROL headerindicates, in seconds, the time when Advertisement becomes valid. ALOCATION header indicates the URL of the PC 200. An NT tag indicates adevice type to be notified to the network. SERVER indicates the OS ofthe PC 200. In FIG. 3 of the embodiment, after the PCs 200 a and 200 bare connected to the network, they multicast SSDP:Alive. If the controlunit 101 detects that it has received SSDP:Alive from the PC 200 on thenetwork, it advances to step S802; if NO in step S801, to step S804.

In step S802, the control unit 101 executes HTTP GET to acquire deviceinformation of the PC 200. A UPnP-compliant PC describes its deviceinformation in the XML (eXtensible Markup Language) format and saves itas a description. Description in FIG. 11A is an example of thedescription saved in the secondary storage device 205 by the PC 200.Description in FIG. 11A is formed from several tags. For example, a UDNtag indicates the GUID (Globally Unique IDentifier) of the PC 200. AfriendlyName tag indicates a PC name. A deviceType tag indicates adevice type. A serviceType tag indicates a service which can be providedby the PC 200. HTTP GET is a method for acquiring data from acommunication destination in accordance with the HTTP protocol. If thecontrol unit 101 detects in step S801 that it has received theSSDP:Alive multicast, it instructs the multicasting PC 200 to transmitthe description.

In step S803, the control unit 101 acquires the description. If the PC200 receives the description transmission instruction from the digitalcamera 100 in step S802, it transmits the description to the digitalcamera 100. The control unit 101 saves, in the RAM of the memory 104,the description acquired via the communication unit 152 and advances tostep S815.

In step S804, the control unit 101 detects whether it has received aMulticastDNS:Notify message multicast. When a device is connected to anetwork in MulticastDNS, it adds, to the Notify message, serviceTypeindicating the presence of the device and services which can be providedby the device, and then multicasts the Notify message to devices on thenetwork. In FIG. 3 of the embodiment, after the PC 200 b is connected tothe network, it adds, to the Notify message, serviceType “_ptp-init”representing that it can operate as an initiator in PTP-IP, andmulticasts the Notify message. If the control unit 101 detects that ithas received the Notify message, it advances to step S805; if NO in stepS804, to step S807.

In step S805, the control unit 101 requests a TXT record. ABonjour-compliant PC describes its device information in the textformat, and saves it as a TXT record. FIG. 12A exemplifies a TXT recordsaved in the secondary storage device 205 by the PC 200. The TXT recordis linked with serviceType, and formed from Key and its value. In theembodiment, serviceType multicast from the PC 200 is “_ptp-init”, andVersion Key of the TXT record linked with serviceType indicates theversion of the TXT record. Model Key indicates the type of device model.Product Key indicates a product name. Service Available Key indicateswhether the service has become valid. If the service has become valid,Value is updated to 1. GUID Key indicates the GUID of the PC 200. If thecontrol unit 101 detects reception of the Notify message in step S802,it refers to serviceType added to the message. If serviceType representsthat the image transfer service can be provided, the control unit 101instructs the multicasting PC to transmit the TXT record. For example,in FIG. 3, assume that serviceType multicast by the PC 200 b is“_ptp-init”, and serviceType of the PC to be searched for by the digitalcamera 100 is “_ptp-init”. In this case, the control unit 101 instructsthe PC 200 b to transmit the TXT record.

In step S806, the control unit 101 acquires the TXT record. If the PC200 receives the TXT record transmission instruction from the digitalcamera 100 in step S805, it transmits the TXT record to the digitalcamera 100. The control unit 101 saves, in the RAM of the memory 104,the TXT record acquired via the communication unit 152 and advances tostep S815.

In step S807, the control unit 101 starts M-Search of SSDP. M-Search isa method of detecting a UPnP-compliant device on a network. M-Search inFIG. 10B is an example of SSDP data for executing M-Search. A HOSTheader indicates a multicast IP address. An ST header indicates a devicetype to be searched for. An MX header indicates, in minutes, the timewhen search becomes valid.

In step S808, the control unit 101 starts Query of MulticastDNS. Queryis a method of detecting a Bonjour-compliant device on a network.serviceType to be searched for is designated, and Query is executed.

In step S809, the control unit 101 detects whether it has received anSSDP response. When M-Search starts in step S807, a UPnP-compliant PC onthe network transmits a response to the digital camera 100. FIG. 10Cexemplifies SSDP data transmitted as Response. An ST header indicates adevice type to be searched for. A LOCATION header indicates the IPaddress of the PC 200. SERVER indicates the OS of the PC 200. Thecontrol unit refers to the ST: tag of M-Search multicast from the PC200. The ST: tag indicates the type of device to be searched for. If thePC 200 is of the target device type, the PC 200 transmits Response inFIG. 10C to the digital camera 100. If the control unit 101 detects theSSDP response via the communication unit 152, it advances to step S810;if NO in step S809, to step S812.

In step S810, the control unit 101 executes HTTP GET for acquiring thedescription of the PC 200. This processing is the same as that in stepS802, and a description thereof will not be repeated.

In step S811, the control unit 101 acquires the description. Thisprocessing is the same as that in step S803, and a description thereofwill not be repeated.

In step S812, the control unit 101 determines whether it has receivedthe Query response of MulticastDNS. If Query starts in step S808, the PC200 corresponding to the set serviceType transmits a response to thedigital camera 100. If the control unit 101 detects the Query response,it advances to step S813. If NO in step S812, the control unit 101determines that no device has been detected, and handles this as no PCdiscovery.

In step S813, the control unit 101 instructs transmission of the TXTrecord. This processing is the same as that in step S805, and adescription thereof will not be repeated.

In step S814, the control unit 101 acquires the TXT record. Thisprocessing is the same as that in step S806, and a description thereofwill not be repeated.

In step S815, the control unit 101 detects whether the PC isconnectable. For a UPnP-compliant PC, the control unit 101 refers to theSERVER headers in FIGS. 10A and 10C and determines whether the OS is aconnection target. If the control unit 101 determines that the OS is aconnection target, it saves the friendlyName tag of the description inFIG. 11A as a PC name in the memory 104 together with GUID described inthe UDN tag. For a Bonjour-compliant PC, the control unit 101 acquiresan address record (not shown), acquires the host name of the PC, andsaves the host name as a PC name in the memory 104 together with GUIDKey of the TXT record in FIG. 12A. Then, the control unit 101 handlesthis as PC discovery. If NO in step S815, the control unit 101 handlesthis as no PC discovery.

Details of the search processing have been described.

In step S703, the control unit 101 detects whether the PC 200 has beendiscovered. If the control unit 101 detects that the PC 200 has beendiscovered in the device search processing of FIG. 8, it advances tostep S704; if NO in step S703, to step S706.

In step S704, the control unit 101 displays the PC name of thediscovered PC 200 on the GUI. The PC name saved in the memory 104 instep S815 of FIG. 8 is displayed as a GUI on the display unit 130. Everytime a PC is discovered, the control unit 101 adds display of its PCname to the GUI. GUIs in FIGS. 13B and 13C are examples of this. On theGUI of FIG. 13B, PC names are displayed on the GUI regardless of thediscovery protocol. As another display method, the PCs 200 may becategorized for respective discovery protocols, as on the GUI of FIG.13C. As still another method, although not shown, search results may bedisplayed at once upon the lapse of the device search time in step S706.

In step S705, the control unit 101 detects whether a PC 200 has beenselected. PC names displayed on the GUI of FIG. 13B in step S704 can beselected using the operation unit 102. When the user selects one of thedisplayed PC names, the control unit 101 advances to step S712; if NO instep S705, to step S706.

In step S706, the control unit 101 detects whether the device searchtime (N min) has elapsed. The device search time is defined in advanceby a program, or is set by the user in a menu mode (not shown) andrecorded in the nonvolatile memory of the memory 104. If the controlunit 101 detects that the defined/set time has elapsed, it advances tostep S707; if NO in step S706, to step S709.

In step S707, the control unit 101 detects whether the PC name hasalready been displayed. When one or more PCs have been discovered,connectable PC names are displayed on the GUI in step S704. If thecontrol unit detects that the GUI has been displayed, it advances tostep S708; if NO in step S707, to step S710.

In step S708, the control unit 101 detects whether a PC 200 has beenselected. This processing is the same as that in step S705, and adescription thereof will not be repeated. If the control unit 101detects that a PC 200 has been selected, it advances to step S712; if NOin step S708, to step S711.

In step S709, the control unit 101 detects whether the device search hasbeen interrupted. On the GUIs of FIGS. 13A and 13B, an interrupt buttonicon 1301 is arranged. When the user presses the interrupt button icon1301, the control unit 101 detects that an interrupt is instructed,interrupts the device search, and advances to step S707. If NO in stepS709, the control unit 101 returns to step S702 and continues the devicesearch.

In step S710, the control unit 101 displays, on the display unit 130, aGUI representing that the PC 200 has not been discovered. The GUI inFIG. 13D is an example of this.

In step S711, the control unit 101 detects whether or not the user hasselected re-search. On the GUI of FIG. 13D, an icon button 1302 forperforming re-search is arranged. If the user operates the operationunit 102 and presses not the re-search icon button but a return button1303, the control unit 101 ends the discovery processing and advances tostep S723. If YES in step S711, the control unit 101 resets the devicesearch time counter, returns to step S702, and executes the devicesearch again.

In step S712, the control unit 101 temporarily saves pairing informationof the selected PC 200 in the RAM of the memory 104. For UPnP, thefollowing information is saved from the description (FIG. 11A) acquiredfrom the selected PC 200:

PC name described in the friendlyName header,

discovered discovery protocol type,

IP address described in the LOCATION header of Advertisement (FIG. 10A)or Response (FIG. 10C), and

GUID (Globally Unique IDentifier) described in the UDN tag.

For Bonjour, the host name and IP address of a PC that have beenacquired from an address record (not shown), the x discovered discoveryprotocol type, and the GUID of GUID Key in the TXT record (FIG. 12A) aresaved.

In step S713, the control unit 101 starts advertisement. Details of theadvertisement processing will be explained with reference to a flowchartshown in FIG. 9. After the start of advertisement processing, thecontrol unit 101 displays a GUI in FIG. 13E on the display unit 130.

In step S901, the control unit 101 detects whether the discoveryprotocol with which the PC 200 was selected in step S705 or S708 hasbeen discovered is UPnP. The control unit 101 refers to the pairinginformation temporarily saved in the RAM of the memory 104 in step S712,and if it detects that the discovery protocol is UPnP, advances to stepS902. If NO in step S901, the control unit 101 advances to step S903.

In step S902, the control unit 101 multicasts SSDP:Alive.

In step S903, the control unit 101 multicasts Multicast DNS Notifytogether with serviceType.

In step S904, the control unit 101 detects whether it has received adescription transmission instruction from the PC 200. If the controlunit 101 detects that it has received a transmission instruction fromthe PC 200, it advances to step S905. If NO in step S904, the controlunit 101 waits until it receives a request. FIG. 11B exemplifies adescription held in the digital camera 100. The description in FIG. 11Bis formed from several tags. For example, a URLBase tag indicates the IPaddress of the digital camera 100. A deviceType tag indicates a devicetype. A friendlyName tag indicates the name of the digital camera 100. AUDN tag indicates the GUID of the digital camera 100. A serviceType tagindicates a service which can be provided by the digital camera 100.HTTP GET is a method for acquiring data from a communication destinationin accordance with the HTTP protocol. If the user presses an interruptbutton icon 1304 on the GUI of FIG. 13E, the control unit 101 interruptsthe advertisement.

In step S905, the control unit 101 transmits the description to therequesting PC 200.

In step S906, the control unit 101 detects whether it has received a TXTrecord transmission instruction. If the control unit 101 detects that ithas received a transmission instruction from the PC 200, it advances tostep S907. If NO in step S906, the control unit 101 waits until itreceives a request. FIG. 12B exemplifies a TXT record held in thedigital camera 100. The TXT record is linked with serviceType, andformed from Key and its value. In the embodiment, serviceType multicastfrom the digital camera 100 is “_ptp”, and Version Key of the TXT recordlinked with serviceType indicates the version of the TXT record. ModelKey indicates the type of device model. Product Key indicates a productname. Service Available Key indicates whether the service has becomevalid. If the service has become valid, Value is updated to 1. GUID Keyindicates the GUID of the digital camera 100. Target GUID Key indicatesthe GUID of the PC 200 selected in step S705. If the user presses theinterrupt button icon 1304 on the GUI of FIG. 13E, the control unit 101interrupts the advertisement.

In step S907, the control unit 101 transmits the TXT record to therequesting PC 200.

Details of the advertisement processing by the digital camera 100 instep S713 have been described.

In step S714, the control unit 101 detects whether it has detectedreception of an InitCommandRequest packet transmitted from the PC 200.The InitCommandRequest packet is one packet type defined by PTP-IP, andis used to exchange device information between a PC and a digital cameraand finalize a TCP port number for transmitting/receiving commands anddata. If the control unit 101 detects reception of InitCommandRequestvia the communication unit 152, it advances to step S715; if NO in stepS714, to step S716.

In step S715, the control unit 101 detects whether identifiers coincidewith each other. In this processing, the control unit 101 detectswhether the PC 200 selected in step S705 or S708 coincides with the PC200 which has transmitted the InitCommandRequest packet. The GUID of thePC 200 is saved in the InitCommandRequest packet received in step S714.This GUID is compared with the GUID saved as pairing information in stepS712. If these GUIDs coincide with each other, the control unit 101determines that the PCs 200 are the same PC, and advances to step S717;if NO in step S715, to step S718. Instead of comparing GUIDs, the IPaddress of a selected PC and that of a PC which has transmittedInitCommandRequest may be compared, and if these IP addresses coincidewith each other, it may be determined that these PCs are the same PC.The identifier is arbitrary as long as it can be confirmed that a PC 200selected in discovery and a PC 200 which has transmitted theInitCommandRequest packet coincide with each other.

In step S716, the control unit 101 detects whether M min serving as theperiod of validity of advertisement processing has elapsed. The periodduring which reception of the InitCommandRequest packet is accepted isdefined in advance by a program, or is set by a user instruction. Thecontrol unit 101 detects whether this period has elapsed. If this periodhas not elapsed, the control unit 101 repeats step S714; if NO in stepS716, to step S723.

In step S717, the control unit 101 transmits an InitAct packet to thePC. If the control unit 101 determines in step S715 that the identifierscoincide with each other, the control unit 101 transmits the InitActpacket to notify the PC that acceptance of the InitCommandRequest packethas been permitted.

In step S718, the control unit 101 transmits an InitFail packet to thePC. If the control unit 101 determines in step S715 that the identifiersdo not coincide with each other, the control unit 101 transmits theInitFail packet to notify the PC that acceptance of theInitCommandRequest packet has been rejected.

In step S719, the control unit 101 detects whether it has received anInitEventRequest packet. The InitEventRequest packet is one packet typedefined by PTP-IP, and finalizes a TCP port number fortransmitting/receiving an event. If the control unit 101 detectsreception of InitEventRequest via the communication unit 152, itadvances to step S720; if NO in step S719, to step S721.

In step S720, the control unit 101 transmits an InitAct packet to thePC.

In step S721, the control unit 101 detects whether M min serving as theperiod of validity of advertisement processing has elapsed. The sameperiod as that in step S716 is set, and if M min has elapsed, thecontrol unit 101 advances to step S723; if NO in step S721, repeats stepS719.

In step S722, the control unit 101 records pairing information. Theinformation saved in the memory 104 in steps S405 and S712 is saved inthe nonvolatile memory. FIG. 14 is a conceptual view showing pairinginformation to be saved. PC Name indicates the name of a connected PC200. PC GUID indicates the GUID of the connected PC 200. DiscoveryProtocol indicates a discovery protocol used in device search. IPAddress indicates the IP address of the connected PC 200. SSID indicatesthe SSID of a network connected in connection to the PC 200. SecurityKey indicates the encryption key of the network connected in connectionto the PC 200.

In step S723, the control unit 101 displays a connection failure screenon the display unit 130. A GUI in FIG. 13F is an example of this.

Details of the discovery processing by the digital camera in connectionfor the first time have been described.

[Discovery Processing (Connection for Second and Subsequent Times) inDigital Camera]

Details of the discovery in step S407 of FIG. 4 will be explained. FIG.15 is a flowchart showing a discovery operation when connecting thedigital camera 100 to a PC which has been connected before. Thisflowchart shows processing until the process returns to the start ofadvertisement processing in step S713 after it is determined in stepS701 of FIG. 7A in discovery processing that the digital camera 100 isto be connected to a PC 200 for the second or subsequent time.

First, in step S1501, the control unit 101 refers to pairinginformation. Pairing information which has been recorded in thenonvolatile memory of the memory 104 in a previous connection isreferred to.

In step S1502, the control unit 101 detects whether the discoveryprotocol of the previously connected PC 200 is UPnP. The control unit101 refers to the discovery protocol in the pairing information in stepS1501, and if the discovery protocol is UPnP, advances to step S1503. IfNO in step S1502, the control unit 101 advances to step S1504.

In step S1503, the control unit 101 searches for UPnP devices. In thiscase, the same processes as those in steps S807, S809, S810, S811, andS815 of FIG. 8 are sequentially performed, so a description thereof willnot be repeated.

In step S1504, the control unit 101 searches for Bonjour devices. Inthis case, the same processes as those in steps S808, S812, S813, S814,and S815 of FIG. 8 are sequentially performed, so a description thereofwill not be repeated.

In step S1505, the control unit 101 detects whether a PC 200 has beendiscovered. The control unit 101 compares the GUID acquired from thedescription or TXT record acquired in step S1503 or S1504 with the GUIDin the pairing information. If these GUIDs coincide with each other, thecontrol unit 101 determines that a PC 200 which has been connectedbefore has been discovered. If NO in step S1505, the control unit 101advances to step S1506.

In step S1506, the control unit 101 detects whether L min has elapsed.That is, if a PC 200, which has been connected before, is notdiscovered, the control unit 101 repeats step S1505 until the timedefined in advance by a program or set by the user has elapsed. If thecontrol unit 101 detects that L min has elapsed, the process advances tostep S1507.

In step S1507, the control unit 101 displays, on the display unit 130, aGUI representing that the PC 200 has not been discovered. A GUI in FIG.13D is an example of this.

If the control unit 101 discovers a PC in step S1505, it advances tostep S713 of FIG. 7B, and starts advertisement processing. Subsequentprocessing is the same as that described above.

Details of the discovery operation for connecting the digital camera 100to a PC which has been connected before have been described.

[Discovery Processing in PC]

Next, details of the discovery in step S602 of FIG. 6 in the PC 200 willbe explained. FIG. 16 is a flowchart showing a discovery operation inthe PC 200.

First, in step S1601, the CPU 203 starts advertisement processing. Theadvertisement processing is provided as a basic function by the OS ofthe PC 200 or as a function of an application installed in the secondarystorage device 205. The PC 200 starts the advertisement processing inconformity with a compliant discovery protocol. A UPnP-compliant PCmulticasts SSDP:Alive. A Bonjour-compliant PC multicasts Multicast DNSNotify.

In step S1602, the CPU 203 detects whether it has received a devicesearch multicast. The digital camera 100 executes M-Search or MulticastDNS Query to multicast the device search to devices on the network. Ifthe CPU 203 detects that it has received the multicast via thecommunication device 206, it advances to step S1603. If NO in stepS1602, the CPU 203 continues the processing until it receives themulticast.

In step S1603, the CPU 203 transmits a response. For M-Search, the CPU203 transmits Response in FIG. 10C. For Query, the CPU 203 refers to theadded serviceType, and if it determines that the serviceType indicatesthe image transfer service held in the PC 200, transmits a response tothe digital camera 100 and advances to step S1604.

In step S1604, the CPU 203 detects whether it has received a descriptionrequest from the digital camera 100. When the digital camera 100receives the response in step S1603, it transmits a descriptionacquisition request to the PC 200. For UPnP, the digital camera 100executes HTTP GET and instructs acquisition of a description. ForBonjour, the digital camera 100 instructs acquisition of a TXT record.If the CPU 203 detects that it has received the description transmissioninstruction via the communication device 206, it advances to step S1605.If NO in step S1604, the CPU 203 waits until it detects the descriptiontransmission instruction.

In step S1605, the CPU 203 transmits the description to the digitalcamera 100. For UPnP, the CPU 203 transmits Description as shown in FIG.11A. For Bonjour, the CPU 203 transmits the TXT record shown in FIG.12A.

In step S1606, the CPU 203 detects whether it has received anadvertisement multicast from the digital camera 100. If the CPU 203detects advertisement processing in step S902 or S903 of FIG. 9, itadvances to step S1607. If NO in step S1606, the CPU 203 continues theprocessing until it receives the advertisement multicast.

In step S1607, the CPU 203 requests the digital camera to transmit adescription.

In step S1608, the CPU 203 receives the description. For UPnP, the CPU203 receives a description as shown in FIG. 11B from the digital camera100. For Bonjour, the CPU 203 receives a TXT record as shown in FIG. 12Bfrom the digital camera 100.

In step S1609, the CPU 203 detects whether the digital camera supportsthe image transfer service. The description describes informationrepresenting whether the digital camera supports the image transferservice.

The CPU 203 refers to the tag, and if it detects that the digital camerasupports the image transfer service, advances to step S1610. If NO instep S1609, the CPU 203 returns to step S1606 and waits until itreceives an advertisement multicast from another PC. As described above,the protocol used in the image transfer service in the embodiment isPTP-IP, and the processing will be explained based on a PTP-IPconnection method.

In step S1610, the CPU 203 transmits an InitCommandRequest packet of thePTP-IP protocol to the digital camera 100.

In step S1611, the CPU 203 detects whether it has received an InitActpacket which has been transmitted from the digital camera 100 andrepresents that the InitCommandRequest packet has been accepted. If theCPU 203 detects that it has received the InitAct packet via thecommunication device 206, it advances to step S1612; if NO in stepS1611, to step S1614.

In step S1612, the CPU 203 transmits an InitEventRequest packet of thePTP-IP protocol to the digital camera 100.

In step S1613, the CPU 203 receives an InitAct packet notifying that thedigital camera 100 has normally processed the InitEventRequest packet.

Upon receiving the InitAct packet, the CPU 203 determines that aconnection with the digital camera 100 has succeeded, advances to stepS603 of FIG. 6, and activates an application which provides the imagetransfer service.

In step S1614, the CPU 203 detects whether it has received an InitFailpacket which has been transmitted from the digital camera 100 andrepresents that acceptance of the InitCommandRequest packet has beenrejected. If the CPU 203 detects that it has received the InitFailpacket, it advances to step S1615. If NO in step S1614, the CPU 203returns to step S1611 and waits for a response to the InitCommandRequestpacket from the digital camera 100.

In step S1615, if the CPU 203 receives the InitFail packet in stepS1614, it determines that a connection with the digital camera 100 hasfailed, and displays, on the display unit 201 of the PC 200, a GUIrepresenting that the connection has failed.

In step S1616, the CPU 203 determines whether to end the connection withthe digital camera. If the user operates the PC and interrupts the startof the image transfer service on a GUI (not shown), the CPU 203 handlesthis as a connection failure, and ends the image transfer service. Ifthe CPU 203 waits for a connection with another digital camera, itreturns to step S1602 and continues the processing.

Details of the discovery processing in step S602 of FIG. 6 in the PChave been described.

Other Embodiments

Although the above embodiment has exemplified a wireless connection inthe playback mode, the present invention is not limited to this mode.For example, a wireless connection button may be prepared in theshooting mode or menu mode, and connection processing may proceed whenthe user presses the button.

In the above embodiment, the digital camera 100, which is an apparatusincorporating the wireless communication function, has been explained asan example of the communication apparatus. However, the presentinvention is also applicable to a device which can be mounted in anotherdevice and provides the wireless communication function. For example, ifa recording medium 141 is a recording medium capable of wirelesscommunication, it may control wireless communication. In this case, thesame control as that in the above embodiment is performed for thewireless circuit (not shown) of the recording medium 141 capable ofwireless communication.

Further, the present invention is also applicable to a system in which adigital camera 100 is remote-controlled from a PC or the like. In thiscase, the remote control can be implemented by making various inquiriesand control requests from the control unit of the PC to a control unit101 of the digital camera 100.

Aspects of the present invention can also be realized by a computer of asystem or apparatus (or devices such as a CPU or MPU) that reads out andexecutes a program recorded on a memory device to perform the functionsof the above-described embodiment(s), and by a method, the steps ofwhich are performed by a computer of a system or apparatus by, forexample, reading out and executing a program recorded on a memory deviceto perform the functions of the above-described embodiment(s). For thispurpose, the program is provided to the computer for example via anetwork or from a recording medium of various types serving as thememory device (for example, computer-readable medium).

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2011-265312, filed on Dec. 2, 2011, which is hereby incorporated byreference herein its entirety.

1. A communication apparatus which establishes a connection with adevice in a network by using a discovery protocol for discovering thedevice, comprising: first transmission means for transmitting a searchcommand to search devices in the network; first reception means forreceiving pieces of device information transmitted from devices in thenetwork in response to the search command; first selection means forselecting a device based on the pieces of device information received bysaid first reception means; second transmission means for transmitting anotification signal to notify devices in the network of presence of thecommunication apparatus after the selection by said first selectionmeans; second reception means for receiving a connection requesttransmitted from a device in the network, the connection request beingtransmitted by a device which has received the notification signal;determination means for determining whether the connection request hasbeen transmitted from the device selected by said first selection means;and third transmission means for transmitting a response representingthat a connection is accepted in response to the connection request ifsaid determination means determines that the connection request has beentransmitted from the device selected by said first selection means. 2.The apparatus according to claim 1, further comprising display means fordisplaying the pieces of device information received by said firstreception means, wherein said first selection means selects a devicebased on device information displayed by said display means.
 3. Theapparatus according to claim 2, wherein each piece of the deviceinformation received by said first reception means contains informationof a service provided by the corresponding device, and said displaymeans displays information of a device which provides a predeterminedservice.
 4. The apparatus according to claim 1, further comprising:registration means for registering, as a destination, a device which hasaccepted connection after said third transmission means transmits theresponse; and second selection means for selecting a device from devicesregistered by said registration means while no connection is establishedwith another device, wherein if said second selection means selects adevice, said second transmission means transmits the notification signalwithout transmitting the search command by said first transmissionmeans.
 5. The apparatus according to claim 1, wherein after said thirdtransmission means transmits the response, data communication isperformed with the device selected by said first selection means byusing a data transfer protocol.
 6. The apparatus according to claim 5,wherein the data transfer protocol includes PTP/IP.
 7. The apparatusaccording to claim 1, wherein the device information received by saidfirst reception means contains a discovery protocol type.
 8. Theapparatus according to claim 1, wherein the communication apparatusincludes one of an image capture apparatus, a mobile phone, and a tabletdevice.
 9. The apparatus according to claim 1, wherein the deviceincludes one of an image capture apparatus, a mobile phone, a tabletdevice, a printer, and a TV receiver.
 10. The apparatus according toclaim 1, wherein the discovery protocol includes one of UPnP andBonjour.
 11. A method of controlling a communication apparatus whichestablishes a connection with a device in a network by using a discoveryprotocol for discovering the device, the method comprising: a firsttransmission step of transmitting a search command to search devices inthe network; a first reception step of receiving pieces of deviceinformation transmitted from devices in the network in response to thesearch command; a first selection step of selecting a device based onthe pieces of device information received in said first reception step;a second transmission step of transmitting a notification signal tonotify devices in the network of presence of the communication apparatusafter the selection in said first selection step; a second receptionstep of receiving a connection request transmitted from a device in thenetwork, the connection request being transmitted by a device which hasreceived the notification signal; a determination step of determiningwhether the connection request has been transmitted from the deviceselected in said first selection step; and a third transmission step oftransmitting a response representing that a connection is accepted inresponse to the connection request if it is determined in saiddetermination step that the connection request has been transmitted fromthe device selected in said first selection step.
 12. A computer programcauses, when executed, a processor to perform the method according toclaim
 11. 13. A computer-readable storage medium on which a computerprogram that causes, when executed, a processor to perform the methodaccording to claim 11.